﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using STSdb.Data;
using STSdb.Persist;
using STSdb.General.Collections;

namespace STSdb.MTL
{
    public interface ITableProperties
    {
        object RecordPersist { get; }
        object KeyMap { get; }
    }

    public class TableProperties<T,T1> : ITableProperties
    {
        public TableProperties()
        {
            //KeyMap = null;
            this.CacheCapacity = 1;
            this.BlockCapacity = 1024;          
        }

        /// <summary>
        /// STSdb specifics. KeyMap
        /// </summary>
        public IKeyMap<T> KeyMap {get; set;}

        /// <summary>
        /// Default is 1. Quantity of storage blocks for in-memory buffer
        /// </summary>
        public uint CacheCapacity { get; set; }

        /// <summary>
        /// Default is 1024. Quantities of rows inside of one storage block. 
        /// </summary>
        public uint BlockCapacity { get; set; }

        /// <summary>
        /// For writing persistent layer.
        /// <para>http://stsdb.com/stsdb-user-forum/128-writing-custom-persist-layer.html</para>
        /// </summary>
        public IBinaryPersist<IIndexer<T1>> RecordPersist { get; set; }

        /// <summary>
        /// For the tables without Table Properties, default values will be taken.
        /// <para>Default value is 1</para>
        /// </summary>
        public static uint DefaultCacheCapacity = 1;

        /// <summary>
        /// <para>For the tables without Table Properties, default values will be taken.</para>
        /// <para>Default table property for WRITE and READ_SYNCHRO locator.</para>
        /// <para>Dynamically applied, for every, create under the hood locator, if Table Property is not suppli after the engien start.</para>
        /// <para>Default value is 1</para>
        /// </summary>
        public static uint DefaultBlockCapacity = 1;

        /// <summary>
        /// <para>For the tables without Table Properties, default values will be taken.</para>
        /// <para>Default table property for READ locator.</para>
        /// <para>Dynamically applied, for every, create under the hood locator, if Table Property is not suppli after the engien start</para>
        /// <para>Default value is 1</para>
        /// </summary>
        public static uint DefaultReadBlockCapacity = 1024;


        /// <summary>
        /// Public Non Generic access to the RecordPersist
        /// </summary>
        object ITableProperties.RecordPersist
        {
            get
            {
                return this.RecordPersist;
            }
            
        }

        /// <summary>
        /// Public Non Generic access to the KeyMap
        /// </summary>
        object ITableProperties.KeyMap
        {
            get { return this.KeyMap; }
        }
    }
}
